package com.wy.scs.rabbitmq.consumer.listener;

import com.alibaba.fastjson.JSON;
import com.wy.scs.rabbitmq.consumer.message.MessageData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @author wangyong
 */
@Slf4j
@Component
public class DemoConsumer {

    @StreamListener(MySink.DEMO_INPUT)
    public void onMessage(@Payload MessageData message) {
        log.info("消费消息：线程编号:{} 消息内容：{}", Thread.currentThread().getId(), JSON.toJSONString(message));
    }

}
